﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Service.Utility
{
    public class ReturnMsg<T>
    { 
        /// <summary>
        /// 成功构造函数
        /// </summary>
        /// <param name="ReBody">实体类或者实体类集合都可以</param>
        public ReturnMsg(T ReBody)
        {
            Status = ReStatus.Success.ToString();
            Body = ReBody;
        }

        /// <summary>
        /// 无参成功构造函数
        /// </summary>
        public ReturnMsg()
        {
            Status = ReStatus.Success.ToString();
        }

        /// <summary>
        /// 失败构造函数
        /// </summary>
        /// <param name="ex"></param>
        public ReturnMsg(string msg)
        {
            Error = msg;
            Status = ReStatus.Fail.ToString();
        }
        public string Error { get; set; }
        public string Status { get; set; }
        public T Body { get; set; }

        }
}
enum ReStatus
{
    /// <summary>
    /// 失败
    /// </summary>
    Fail = 0,
    /// <summary>
    /// 成功
    /// </summary>
    Success = 1
}
